<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use App\Admin\AdminUser;
use App\Admin\Authority;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

Route::group(['prefix' => 'admin', 'namespace' => 'Admin'],function() {

    Route::post('auth/login', [AdminUser::class, 'login']) -> name('auth.login');

    Route::middleware('admin.auth')->group(function () {
        // 管理员管理
        Route::get('auth/userList', [AdminUser::class, 'userList']) -> name('auth.userList');
        Route::get('auth/deleteUser', [AdminUser::class, 'deleteUser']) -> name('auth.deleteUser');
        Route::post('auth/addUser', [AdminUser::class, 'addUser']) -> name('auth.addUser');
        Route::post('auth/updateUser', [AdminUser::class, 'updateUser']) -> name('auth.updateUser');
        Route::get('auth/logout', [AdminUser::class, 'logout']) -> name('auth.logout');

        // 角色管理
        Route::get('auth/roleList', [Authority::class, 'roleList']) -> name('auth.roleList');
        Route::get('auth/deleteRole', [Authority::class, 'deleteRole']) -> name('auth.deleteRole');
        Route::post('auth/addRole', [Authority::class, 'addRole']) -> name('auth.addRole');
        Route::post('auth/updateRole', [Authority::class, 'updateRole']) -> name('auth.updateRole');

        // 菜单管理
        Route::get('auth/menuList', [Authority::class, 'menuList']) -> name('auth.menuList');
        Route::get('auth/deleteMenu', [Authority::class, 'deleteMenu']) -> name('auth.deleteMenu');
        Route::post('auth/addMenu', [Authority::class, 'addMenu']) -> name('auth.addMenu');
        Route::post('auth/updateMenu', [Authority::class, 'updateMenu']) -> name('auth.updateMenu');

        // 菜单管理
        Route::get('auth/nodeList', [Authority::class, 'nodeList']) -> name('auth.nodeList');
        Route::get('auth/deleteNode', [Authority::class, 'deleteNode']) -> name('auth.deleteNode');
        Route::post('auth/addNode', [Authority::class, 'addNode']) -> name('auth.addNode');
        Route::post('auth/updateNode', [Authority::class, 'updateNode']) -> name('auth.updateNode');
    });


});
